package com.platform.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.platform.dao.ApiLikeRecordMapper;
import com.platform.entity.LikeRecordVo;
 
/**
 * 点赞记录表Service实现类
 *
 * @author czj
 * @email 729618941@qq.com
 * @date 2018-11-06 09:33:26
 */
@Service 
public class ApiLikeRecordService   {
	
    @Autowired
    private ApiLikeRecordMapper likeRecordDao;

     
    public LikeRecordVo queryObject(Integer id) {
        return likeRecordDao.queryObject(id);
    }

     
    public List<LikeRecordVo> queryList(Map<String, Object> map) {
        return likeRecordDao.queryList(map);
    }

     
    public int queryTotal(Map<String, Object> map) {
        return likeRecordDao.queryTotal(map);
    }

     
    public int save(LikeRecordVo likeRecord) {
        return likeRecordDao.save(likeRecord);
    }

     
    public int update(LikeRecordVo likeRecord) {
        return likeRecordDao.update(likeRecord);
    }

     
    public int delete(Integer id) {
        return likeRecordDao.delete(id);
    }

     
    public int deleteBatch(Integer[]ids) {
        return likeRecordDao.deleteBatch(ids);
    }

    public Boolean isLiked(Integer typeId, Integer valueId, Long userId) {

        Map<String, Object> params = new HashMap<>();
        params.put("userId", userId);
        params.put("typeId", typeId);
        params.put("valueId", valueId);

        int i = queryTotal(params);

        if (i == 0) {
            return false;
        }

        return true;
    }
}
